Optimize split calculation in DF source - #9167
Conversation
2fbb89b to
60a0ff2
Compare
60a0ff2 to
ea6d06e
Compare
Polar Signals Profiling ResultsLatest Run
Previous Runs (10)
Powered by Polar Signals Cloud |
Benchmarks: PolarSignals Profiling 📖Vortex (geomean): 0.975x ➖ datafusion / vortex-file-compressed / ns (0.975x ➖, 1↑ 0↓)
No file size changes detected. |
Benchmarks: FineWeb NVMe 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.972x ➖, 2↑ 0↓)
datafusion / parquet / ns (0.987x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed / ns (1.027x ➖, 0↑ 0↓)
duckdb / parquet / ns (1.002x ➖, 0↑ 0↓)
File Size Changes (2 files changed, -46.3% overall, 0↑ 2↓)
Totals:
|
Benchmarks: FineWeb S3 📖Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (1.263x ➖, 0↑ 5↓)
datafusion / parquet / ns (1.210x ➖, 0↑ 3↓)
duckdb / vortex-file-compressed / ns (1.042x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.974x ➖, 1↑ 1↓)
|
Benchmarks: Clickbench Sorted on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (1.032x ➖, 1↑ 1↓)
datafusion / parquet / ns (0.983x ➖, 2↑ 0↓)
duckdb / vortex-file-compressed / ns (1.001x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.991x ➖, 1↑ 0↓)
File Size Changes (201 files changed, -42.8% overall, 56↑ 145↓)
Totals:
|
Benchmarks: TPC-H SF=10 on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.879x ✅, 9↑ 0↓)
datafusion / parquet / ns (1.003x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed / ns (1.016x ➖, 0↑ 0↓)
duckdb / parquet / ns (1.000x ➖, 0↑ 0↓)
File Size Changes (9 files changed, -44.0% overall, 0↑ 9↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.991x ➖, 1↑ 0↓)
datafusion / parquet / ns (1.001x ➖, 1↑ 2↓)
duckdb / vortex-file-compressed / ns (0.973x ➖, 13↑ 5↓)
duckdb / parquet / ns (1.014x ➖, 4↑ 9↓)
File Size Changes (25 files changed, -43.5% overall, 0↑ 25↓)
Totals:
|
Benchmarks: Statistical and Population Genetics 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed / ns (1.003x ➖, 3↑ 4↓)
duckdb / parquet / ns (0.997x ➖, 0↑ 0↓)
File Size Changes (2 files changed, -32.3% overall, 0↑ 2↓)
Totals:
|
Benchmarks: Clickbench on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (1.009x ➖, 2↑ 5↓)
datafusion / parquet / ns (1.012x ➖, 1↑ 2↓)
duckdb / vortex-file-compressed / ns (1.030x ➖, 1↑ 6↓)
duckdb / parquet / ns (0.991x ➖, 0↑ 1↓)
File Size Changes (101 files changed, -39.2% overall, 0↑ 101↓)
Totals:
|
Benchmarks: TPC-H SF=1 on S3 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (1.006x ➖, 0↑ 0↓)
datafusion / parquet / ns (0.984x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed / ns (0.961x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.958x ➖, 0↑ 0↓)
|
Benchmarks: TPC-H SF=1 on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.951x ➖, 3↑ 0↓)
datafusion / parquet / ns (1.026x ➖, 0↑ 3↓)
duckdb / vortex-file-compressed / ns (0.976x ➖, 1↑ 0↓)
duckdb / parquet / ns (0.999x ➖, 0↑ 0↓)
File Size Changes (9 files changed, -43.9% overall, 0↑ 9↓)
Totals:
|
57c29f4 to
10cbfb8
Compare
10cbfb8 to
a127540
Compare
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
bd3954d to
762c28f
Compare
Merging this PR will degrade performance by 11.64%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Benchmarks: PolarSignals Profiling 📖Vortex (geomean): 0.954x ➖ datafusion / vortex-file-compressed / ns (0.954x ➖, 2↑ 0↓)
No file size changes detected. |
Benchmarks: Clickbench on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.914x ➖, 10↑ 1↓)
datafusion / parquet / ns (0.998x ➖, 0↑ 1↓)
duckdb / vortex-file-compressed / ns (0.992x ➖, 2↑ 2↓)
duckdb / parquet / ns (1.005x ➖, 0↑ 2↓)
File Size Changes (101 files changed, -39.2% overall, 0↑ 101↓)
Totals:
|
Benchmarks: TPC-H SF=1 on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.939x ➖, 5↑ 1↓)
datafusion / parquet / ns (1.016x ➖, 0↑ 3↓)
duckdb / vortex-file-compressed / ns (1.004x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.996x ➖, 0↑ 0↓)
File Size Changes (9 files changed, -43.9% overall, 0↑ 9↓)
Totals:
|
Benchmarks: FineWeb NVMe 📖Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (1.052x ➖, 0↑ 1↓)
datafusion / parquet / ns (1.033x ➖, 0↑ 1↓)
duckdb / vortex-file-compressed / ns (1.020x ➖, 0↑ 2↓)
duckdb / parquet / ns (1.014x ➖, 0↑ 0↓)
File Size Changes (2 files changed, -46.3% overall, 0↑ 2↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVME 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.980x ➖, 3↑ 0↓)
datafusion / parquet / ns (1.002x ➖, 0↑ 4↓)
duckdb / vortex-file-compressed / ns (1.012x ➖, 3↑ 9↓)
duckdb / parquet / ns (1.000x ➖, 3↑ 3↓)
File Size Changes (25 files changed, -43.5% overall, 0↑ 25↓)
Totals:
|
Benchmarks: Clickbench Sorted on NVME 📖Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.922x ➖, 5↑ 0↓)
datafusion / parquet / ns (1.027x ➖, 0↑ 1↓)
duckdb / vortex-file-compressed / ns (1.021x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.983x ➖, 0↑ 0↓)
File Size Changes (201 files changed, -42.8% overall, 58↑ 143↓)
Totals:
|
Benchmarks: TPC-H SF=1 on S3 📖Verdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (0.907x ➖, 0↑ 0↓)
datafusion / parquet / ns (0.961x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed / ns (0.988x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.952x ➖, 0↑ 0↓)
|
Benchmarks: FineWeb S3 📖Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed / ns (1.287x ➖, 0↑ 4↓)
datafusion / parquet / ns (1.050x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed / ns (0.953x ➖, 0↑ 0↓)
duckdb / parquet / ns (0.782x ➖, 1↑ 0↓)
|
| debug_assert_eq!( | ||
| assignment_bytes.len() + usize::from(!row_boundaries.is_empty()), | ||
| row_boundaries.len() | ||
| ); |
There was a problem hiding this comment.
this is incorrect if row_count == 0 but there's no test that hits this
There was a problem hiding this comment.
if there are 0 rows, do we report a single split at 0?
There was a problem hiding this comment.
I think this is only ever possible to generate in tests that's why this is confusing, no production path would do this but tests can. I think we can have a single split at 0 or no splits?
There was a problem hiding this comment.
no splits works here IMO, but I'll try a test with one split.
| /// Shared full-file natural split ranges keyed by path. | ||
| natural_split_ranges: Arc<DashMap<Path, Arc<[Range<u64>]>>>, | ||
| /// Shared full-file natural splits keyed by path. | ||
| natural_splits: Arc<DashMap<Path, Arc<NaturalSplits>>>, |
There was a problem hiding this comment.
This is scoped to a single table read right?
There was a problem hiding this comment.
Yes.
I think there's a way to make this more robust which also applies to other file-specific stuff we cache, I'll do it as a follow up.
Rationale for this change
When DataFusion splits a Vortex file into byte ranges, every partition open recomputed the file's natural splits and linearly scanned them to translate its byte range into row boundaries — identical work repeated N times per file, with the layout walks contending on lazily-initialized layout children.
Now the splits are computed once per file (for only the fields the scan references), cached with precomputed assignment bytes so the translation is a binary search, and handed back to the
ScanBuilderso per-partitionprepare()skips its layout walk entirely.What changes are included in this PR?
vortex-datafusion: per-fileNaturalSplitscache (boundaries + sorted assignment bytes), computed under theDashMapentry so concurrent partitions wait for the winner instead of racing the walk.vortex-layout: newScanBuilder::full_file_splits()/with_natural_splits();Splits::Naturalnow holdsArc<[u64]>. FixedRepeatedScan::executeemitting an empty leading split when the row range starts on a natural boundary (the common case for translated ranges).vortex-layoutandvortex-datafusionsuites pass.What APIs are changed? Are there any user-facing changes?
New public
ScanBuilder::full_file_splits()andwith_natural_splits().Splits::Natural's type change is in a private module. No user-facing behavior changes.